package com.duanjw.springframework.ioc.lifecycle.config;

import com.duanjw.springframework.ioc.lifecycle.dao.impl.UserDaoImpl3;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * 配置
 *
 * @author duanjw
 */
@Configuration
@ComponentScan("com.duanjw.springframework.ioc.lifecycle")
public class AppConfig {

    /**
     * Java Config方式配置bean
     * 并设置init和destroy方法
     *
     * @return
     */
    @Bean(initMethod = "init", destroyMethod = "destroy")
    public UserDaoImpl3 userDaoImpl3() {
        return new UserDaoImpl3();
    }
}
